/*     */ package com.cr.web.controller.system;
/*     */ 
/*     */ import com.cr.common.annotation.Log;
/*     */ import com.cr.common.core.controller.BaseController;
/*     */ import com.cr.common.core.domain.AjaxResult;
/*     */ import com.cr.common.core.domain.entity.SysDictData;
/*     */ import com.cr.common.core.page.TableDataInfo;
/*     */ import com.cr.common.enums.BusinessType;
/*     */ import com.cr.common.utils.poi.ExcelUtil;
/*     */ import com.cr.system.service.ISysDictDataService;
/*     */ import java.util.List;
/*     */ import org.apache.shiro.authz.annotation.RequiresPermissions;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.ui.ModelMap;
/*     */ import org.springframework.validation.annotation.Validated;
/*     */ import org.springframework.web.bind.annotation.GetMapping;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.PostMapping;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ import org.springframework.web.bind.annotation.ResponseBody;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/system/dict/data"})
/*     */ public class SysDictDataController extends BaseController {
/*  32 */   private String prefix = "system/dict/data";
/*     */   
/*     */   @Autowired
/*     */   private ISysDictDataService dictDataService;
/*     */   
/*     */   @RequiresPermissions({"system:dict:view"})
/*     */   @GetMapping
/*     */   public String dictData() {
/*  41 */     return this.prefix + "/data";
/*     */   }
/*     */   
/*     */   @PostMapping({"/list"})
/*     */   @RequiresPermissions({"system:dict:list"})
/*     */   @ResponseBody
/*     */   public TableDataInfo list(SysDictData dictData) {
/*  49 */     startPage();
/*  50 */     List<SysDictData> list = this.dictDataService.selectDictDataList(dictData);
/*  51 */     return getDataTable(list);
/*     */   }
/*     */   
/*     */   @Log(title = "字典数据", businessType = BusinessType.EXPORT)
/*     */   @RequiresPermissions({"system:dict:export"})
/*     */   @PostMapping({"/export"})
/*     */   @ResponseBody
/*     */   public AjaxResult export(SysDictData dictData) {
/*  60 */     List<SysDictData> list = this.dictDataService.selectDictDataList(dictData);
/*  61 */     ExcelUtil<SysDictData> util = new ExcelUtil(SysDictData.class);
/*  62 */     return util.exportExcel(list, "字典数据");
/*     */   }
/*     */   
/*     */   @GetMapping({"/add/{dictType}"})
/*     */   public String add(@PathVariable("dictType") String dictType, ModelMap mmap) {
/*  71 */     mmap.put("dictType", dictType);
/*  72 */     return this.prefix + "/add";
/*     */   }
/*     */   
/*     */   @Log(title = "字典数据", businessType = BusinessType.INSERT)
/*     */   @RequiresPermissions({"system:dict:add"})
/*     */   @PostMapping({"/add"})
/*     */   @ResponseBody
/*     */   public AjaxResult addSave(@Validated SysDictData dict) {
/*  84 */     dict.setCreateBy(getLoginName());
/*  85 */     return toAjax(this.dictDataService.insertDictData(dict));
/*     */   }
/*     */   
/*     */   @GetMapping({"/edit/{dictCode}"})
/*     */   public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) {
/*  94 */     mmap.put("dict", this.dictDataService.selectDictDataById(dictCode));
/*  95 */     return this.prefix + "/edit";
/*     */   }
/*     */   
/*     */   @Log(title = "字典数据", businessType = BusinessType.UPDATE)
/*     */   @RequiresPermissions({"system:dict:edit"})
/*     */   @PostMapping({"/edit"})
/*     */   @ResponseBody
/*     */   public AjaxResult editSave(@Validated SysDictData dict) {
/* 107 */     dict.setUpdateBy(getLoginName());
/* 108 */     return toAjax(this.dictDataService.updateDictData(dict));
/*     */   }
/*     */   
/*     */   @Log(title = "字典数据", businessType = BusinessType.DELETE)
/*     */   @RequiresPermissions({"system:dict:remove"})
/*     */   @PostMapping({"/remove"})
/*     */   @ResponseBody
/*     */   public AjaxResult remove(String ids) {
/* 117 */     this.dictDataService.deleteDictDataByIds(ids);
/* 118 */     return success();
/*     */   }
/*     */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\classes\com.zip!\com\cr\web\controller\system\SysDictDataController.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */